//
//  STHairerHeaderCell.m
//  YiYueHairdresser
//
//  Created by zhouzhouzhou on 2018/10/10.
//  Copyright © 2018年 YuYiLian. All rights reserved.
//

#import "STHairerHeaderCell.h"
#import "AnotherStarEvaluator.h"
#import "UIImage+Extension.h"

@implementation STHairerHeaderCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
  
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    return self;
}


-(void)setHeaderViewWithData:(STHairDetailInfoModel *)infoDic{
    
    self.backView.layer.cornerRadius = 5;
    [self.backView.layer setLayerShadow:[UIColor blackColor] offset:CGSizeMake(0, 3) radius:2];
    self.backView.layer.shadowOpacity = 0.3;
    self.headImg.layer.cornerRadius = self.headImg.frame.size.height/2;
    self.headImg.layer.masksToBounds = YES;
    [self.backImg sd_setImageWithURL:[NSURL URLWithString:infoDic.headPortrait] placeholderImage:[UIImage imageNamed:@"m-adv"]];
    [self.headImg sd_setImageWithURL:[NSURL URLWithString:infoDic.headPortrait] placeholderImage:[UIImage imageNamed:@"m-adv"]];
    [UIImage boxblurImage:self.headImg.image withBlurNumber:0.8];
    self.nameLab.text = infoDic.nickname;
    if ([infoDic.gender isEqualToString:@"1"]) {
        self.sexImg.image = [UIImage imageNamed:@"u-girl"];
    }else if ([infoDic.gender isEqualToString:@"2"]){
        self.sexImg.image = [UIImage imageNamed:@"u-boy"];
    }
    self.detailLab.text = [NSString stringWithFormat:@"%@/%@/%@/",infoDic.yearbirth,infoDic.lable,infoDic.position];
    self.serLab.text = [NSString stringWithFormat:@"服务类别：%@",infoDic.serverTypes];
    self.markLab.text =[NSString stringWithFormat:@"%0.1f分",infoDic.star];
    [self setStarView:infoDic.star];
}

-(void)setStarView:(float)star{
    AnotherStarEvaluator *starAllEva = [[AnotherStarEvaluator alloc] initWithFrame:CGRectMake(15,(self.starBackView.frame.size.height-28)/2, 121, 28)];
    //    starAllEva.delegate = self;
    starAllEva.enabled=NO;
    [starAllEva setCurrentValue:star];
    self.markLab.text = [NSString stringWithFormat:@"%0.1f分",star];
    [self.starBackView addSubview:starAllEva];
}

@end
